<!doctype html>



  


<html class="theme-next pisces use-motion">
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PBHRK7');</script>
<!-- End Google Tag Manager -->
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="前端 知识 面试," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.2" />






<meta name="description" content="前言  貌似又到了一年一度跑路跳槽的时刻，由于个人的一些原因最近也参加了很多面试，发现有很多基础性的东西掌握程度还是不够，故此想总结一下最近面试遇到的问题以及个人认为比较重要的东西，留给自己消化，也分享给有需要的小伙伴 如果文章中有出现纰漏、错误之处，还请看到的小伙伴多多指教，先行谢过 好了，废话不多说，以下 ↓ HTML1. Doctype作用，HTML5 为什么只需要写 &amp;lt;!DOCTYP">
<meta name="keywords" content="前端 知识 面试">
<meta property="og:type" content="article">
<meta property="og:title" content="前端面试《第十六篇》 html+css">
<meta property="og:url" content="http://wurh.github.io/2019/03/31/201904010033/index.html">
<meta property="og:site_name" content="华Ing&#39;s blog">
<meta property="og:description" content="前言  貌似又到了一年一度跑路跳槽的时刻，由于个人的一些原因最近也参加了很多面试，发现有很多基础性的东西掌握程度还是不够，故此想总结一下最近面试遇到的问题以及个人认为比较重要的东西，留给自己消化，也分享给有需要的小伙伴 如果文章中有出现纰漏、错误之处，还请看到的小伙伴多多指教，先行谢过 好了，废话不多说，以下 ↓ HTML1. Doctype作用，HTML5 为什么只需要写 &amp;lt;!DOCTYP">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2019-07-12T06:10:38.190Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="前端面试《第十六篇》 html+css">
<meta name="twitter:description" content="前言  貌似又到了一年一度跑路跳槽的时刻，由于个人的一些原因最近也参加了很多面试，发现有很多基础性的东西掌握程度还是不够，故此想总结一下最近面试遇到的问题以及个人认为比较重要的东西，留给自己消化，也分享给有需要的小伙伴 如果文章中有出现纰漏、错误之处，还请看到的小伙伴多多指教，先行谢过 好了，废话不多说，以下 ↓ HTML1. Doctype作用，HTML5 为什么只需要写 &amp;lt;!DOCTYP">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'Author'
    }
  };
</script>




  <link rel="canonical" href="http://wurh.github.io/2019/03/31/201904010033/"/>


  <title> 前端面试《第十六篇》 html+css | 华Ing's blog </title>
</head>

<body itemscope itemtype="//schema.org/WebPage" lang="en">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PBHRK7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

  










  
  
    
  

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-69412379-1', 'auto');
  ga('send', 'pageview');

</script>

  <script>
  var _hmt = _hmt || [];
  (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b3ddfb8655d8b77429e04c7a4d5bcbc1";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
  </script>


  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="//schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">华Ing's blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">harder and harder</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="//schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                前端面试《第十六篇》 html+css
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">Posted on</span>
            <time itemprop="dateCreated" datetime="2019-03-31T17:31:12+08:00" content="2019-03-31">
              2019-03-31
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">In</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/前端面试/" itemprop="url" rel="index">
                    <span itemprop="name">前端面试</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2019/03/31/201904010033/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2019/03/31/201904010033/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="start">前言</h3>

<p>貌似又到了一年一度跑路跳槽的时刻，由于个人的一些原因最近也参加了很多面试，发现有很多基础性的东西掌握程度还是不够，故此想总结一下最近面试遇到的问题以及个人认为比较重要的东西，留给自己消化，也分享给有需要的小伙伴</p>
<p>如果文章中有出现纰漏、错误之处，还请看到的小伙伴多多指教，先行谢过</p>
<p>好了，废话不多说，以下 ↓</p>
<h3 id="HTML"><a href="#HTML" class="headerlink" title="HTML"></a>HTML</h3><h5 id="l1">1. Doctype作用，HTML5 为什么只需要写 &lt;!DOCTYPE HTML&gt;</h5>

<blockquote>
<p>doctype是一种标准通用标记语言的文档类型声明，目的是告诉标准通用标记语言解析器要使用什么样的文档类型定义（DTD）来解析文档.<code>&lt;!DOCTYPE&gt;</code>声明必须是HTML文档的第一行，位于html标签之前</p>
</blockquote>
<blockquote>
<p>HTML5不基于SGML，所以不需要引用DTD。在HTML5中&lt;!DOCTYPE&gt;只有一种</p>
</blockquote>
<blockquote>
<p>SGML: 标准通用标记语言,是现时常用的超文本格式的最高层次标准</p>
</blockquote>
<h5 id="l2">2. 行内元素有哪些，块级元素有哪些，空(void)元素有那些</h5>

<p>行内元素：<code>a</code> <code>span</code> <code>i</code> <code>img</code> <code>input</code> <code>select</code> <code>b</code> 等</p>
<p>块级元素：<code>div</code> <code>ul</code> <code>ol</code> <code>li</code> <code>h1~h6</code> <code>p</code> <code>table</code> 等</p>
<p>空元素：<code>br</code> <code>hr</code> <code>link</code> 等</p>
<h5 id="l3">3. 简述一下你对HTML语义化的理解</h5>

<p>简单来说，就是合适的标签做合适的事情，这样具有以下好处：</p>
<ul>
<li>有助于构架良好的HTML结构，有利于搜索引擎的建立索引、抓取，利于SEO</li>
<li>有利于不同设备的解析</li>
<li>有利于构建清晰的机构，有利于团队的开发、维护</li>
</ul>
<h5 id="l4">4. 常见的浏览器内核有哪些，介绍一下你对浏览器内核的理解</h5>

<blockquote>
<p>Trident内核：IE</p>
</blockquote>
<blockquote>
<p>Gecko内核：NETSCAPE6及以上版本，火狐</p>
</blockquote>
<blockquote>
<p>Presto内核：Opera7及以上。[Opera内核原为：Presto，现为：Blink;]</p>
</blockquote>
<blockquote>
<p>Webkit内核：Safari，Chrome等。[Chrome的：Blink（WebKit的分支）] </p>
</blockquote>
<p>浏览器内核又可以分成两部分：<strong>渲染引擎和JS引擎。</strong> 渲染引擎主要负责取得网页的内容、整理讯息、计算网页的显示方式等，JS引擎则是解析Javascript语言，执行javascript语言来实现网页的动态效果。</p>
<h5 id="l5">5. html5有哪些新特性</h5>

<ul>
<li>语义化标签: <code>header</code> <code>footer</code> <code>nav</code> <code>section</code> <code>article</code> <code>aside</code> 等</li>
<li>增强型表单：<code>date</code>(从一个日期选择器选择一个日期) <code>email</code>(包含 e-mail 地址的输入域) <code>number</code>(数值的输入域) <code>range</code>(一定范围内数字值的输入域) <code>search</code>(用于搜索域) <code>tel</code>(定义输入电话号码字段) 等</li>
<li>视频和音频：<code>audio</code> <code>video</code></li>
<li>Canvas绘图 SVG绘图</li>
<li>地理定位：<code>Geolocation</code></li>
<li>拖放API：<code>drag</code></li>
<li>web worker：是运行在后台的 JavaScript，独立于其他脚本，不会影响页面的性能</li>
<li>web storage: <code>localStorage</code> <code>sessionStorage</code> </li>
<li>WebSocket: HTML5开始提供的一种在单个 TCP 连接上进行全双工通讯的协议</li>
</ul>
<h5 id="l6">6. 描述一下 cookie，sessionStorage 和 localStorage 的区别</h5>

<table><br>   <tr><br>        <th width="20%">特性</th><br>        <th width="25%" style="text-align:center">Cookie</th><br>        <th widht="25%" style="text-align:center">localStorage</th><br>        <th widht="25%" style="text-align:center">sessionStorage</th><br>   </tr><br>   <tr><br>        <td>生命周期</td><br>        <td>可设置失效时间，没有设置的话，默认是关闭浏览器后失效</td><br>        <td>除非被手动清除，否则将会永久保存</td><br>        <td>仅在当前网页会话下有效，关闭页面或浏览器后就会被清除</td><br>   </tr><br>   <tr><br>        <td>存放数据大小</td><br>        <td>4KB左右</td><br>        <td colspan="2" align="center">可以保存5MB的信息</td><br>   </tr><br>   <tr><br>        <td rowspan="3">http请求</td><br>        <td>每次都会携带在HTTP头中，如果使用cookie保存过多数据会带来性能问题</td><br>        <td colspan="2">仅在客户端（即浏览器）中保存，不参与和服务器的通信</td><br>   </tr><br></table>


<h5 id="l7">7. 如何实现浏览器内多个标签页之间的通信</h5>

<ul>
<li>使用localStorage: <code>localStorage.setItem(key,value)</code>、<code>localStorage.getItem(key)</code></li>
<li>websocket协议</li>
<li>webworker</li>
</ul>
<p><a href="https://juejin.im/post/5acdba01f265da23826e5633" target="_blank" rel="noopener">多个标签页之间的通信</a></p>
<h5 id="l8">8. HTML5的离线存储怎么使用，解释一下工作原理</h5>

<p><a href="https://segmentfault.com/a/1190000006984353" target="_blank" rel="noopener">HTML5的离线存储</a></p>
<h5 id="l9">9. src与href的区别</h5>

<p>区别：src用于替代这个元素，而href用于建立这个标签与外部资源之间的关系</p>
<p><code>&lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; /&gt;</code>浏览器加载到这里的时候，html的渲染和解析不会暂停，css文件的加载是同时进行的</p>
<p><code>&lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;</code>当浏览器解析到这句代码时，页面的加载和解析都会暂停直到浏览器拿到并执行完这个js文件</p>
<h5 id="l10">10. 表单提交中Get和Post方式的区别</h5>

<ul>
<li>Get一般用于从服务器上获取数据，Post向服务器传送数据</li>
<li>Get传输的数据是拼接在Url之后的，对用户是可见的；Post的传输数据对用户是不可见的</li>
<li>Get传送的数据量较小，不能大于2KB。Post传送的数据量较大，一般被默认为不受限制</li>
<li>Get安全性非常低，Post安全性较高</li>
<li>在FORM提交的时候，如果不指定Method，则默认为Get请求</li>
</ul>
<h3 id="CSS"><a href="#CSS" class="headerlink" title="CSS"></a>CSS</h3><h5 id="c1">1. css盒子模型，box-sizing属性的理解</h5>

<p>css的盒模型由content(内容)、padding(内边距)、border(边框)、margin(外边距)组成。但盒子的大小由content+padding+border这几部分决定</p>
<p>box-sizing是一个CSS3属性，与盒子模型有着密切联系。即决定元素的宽高如何计算，box-sizing有三个属性：<br><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">box-sizing: content-box|border-box|inherit:</span><br></pre></td></tr></table></figure></p>
<ul>
<li>content-box 使得元素的宽高即为内容区的宽高(默认模式)</li>
<li>border-box: 计算方式content + padding + border = 本身元素大小，即缩小了content大小</li>
<li>inherit 指定box-sizing属性的值，应该从父元素继承</li>
</ul>
<h5 id="c2">2. 清除浮动，什么时候需要清除浮动，清除浮动都有哪些方法</h5>

<p>浮动的元素是脱离文档标准流的，如果我们不清楚浮动，那么就会造成<strong>父元素高度塌陷</strong>，影响页面布局。</p>
<p>清除浮动的方式：</p>
<ul>
<li>为父元素设置高度</li>
<li>为父元素添加<code>overflow:hidden</code></li>
<li>伪元素<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.fix</span><span class="selector-pseudo">::after</span> &#123; </span><br><span class="line">     <span class="attribute">content</span>:<span class="string">""</span>; </span><br><span class="line">     <span class="attribute">display</span>:block; </span><br><span class="line">     <span class="attribute">clear</span>:both;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>使用伪元素的好处：不增加冗余的DOM节点，符合语义化</p>
<blockquote>
<p>overflow:hidden可以触发BFC机制。BFC：块级格式化上下文，创建了 BFC的元素就是一个独立的盒子，它规定了内部如何布局，并且与这个独立盒子里的布局不受外部影响，当然它也不会影响到外面的元素，<strong>计算BFC的高度时，浮动元素也参与计算</strong></p>
</blockquote>
<h5 id="c3">3. 如何让一个不定宽高的盒子水平垂直居中</h5>

<blockquote>
<p>定位的方式</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.father</span> &#123;</span><br><span class="line">    <span class="attribute">position</span>: relative;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.son</span> &#123;</span><br><span class="line">    <span class="attribute">position</span>: absolute;</span><br><span class="line">    <span class="attribute">top</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">right</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">bottom</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">left</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">margin</span>: auto;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>css3属性</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.father</span> &#123;</span><br><span class="line">    <span class="attribute">position</span>: relative;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.son</span> &#123;</span><br><span class="line">    <span class="attribute">position</span>: absolute;</span><br><span class="line">    <span class="attribute">top</span>: <span class="number">50%</span>;</span><br><span class="line">    <span class="attribute">left</span>: <span class="number">50%</span>;</span><br><span class="line">    <span class="attribute">transform</span>: <span class="built_in">translate</span>(-50%, -50%);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>flex布局</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.father</span> &#123;</span><br><span class="line">    <span class="attribute">display</span>: flex;</span><br><span class="line">    <span class="attribute">justify-content</span>: center;</span><br><span class="line">    <span class="attribute">align-items</span>: center;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h5 id="c4">4. px和em和rem的区别</h5>

<blockquote>
<p><code>px</code>: 像素，相对长度单位。像素<code>px</code>是相对于显示器屏幕分辨率而言的</p>
</blockquote>
<blockquote>
<p><code>em</code>的值并不是固定的，会继承父级元素的字体大小，代表倍数</p>
</blockquote>
<blockquote>
<p><code>rem</code>的值并不是固定的，始终是基于根元素 <code>&lt;html&gt;</code> 的，也代表倍数</p>
</blockquote>
<h5 id="c5">5. position的值有哪些</h5>

<blockquote>
<p>static： 默认值。没有定位，元素出现在正常的流中</p>
</blockquote>
<blockquote>
<p>relative（相对定位）：生成相对定位的元素,相对于其正常（原先本身）位置进行定位</p>
</blockquote>
<blockquote>
<p>absolute（绝对定位）：生成绝对定位的元素，相对于static定位以外的第一个父元素进行定位</p>
</blockquote>
<blockquote>
<p>fixed（固定定位）：生成绝对定位的元素，相对于浏览器窗口进行定位</p>
</blockquote>
<h5 id="c6">6. display:none与visibility：hidden的区别</h5>

<table>
<thead>
<tr>
<th>区别</th>
<th>display:none</th>
<th>visibility：hidden的</th>
</tr>
</thead>
<tbody>
<tr>
<td>是否占据空间</td>
<td>不占据任何空间，在文档渲染时，该元素如同不存在（但依然存在文档对象模型树中）</td>
<td>该元素空间依旧存在</td>
</tr>
<tr>
<td>是否渲染</td>
<td>会触发reflow（回流），进行渲染</td>
<td>只会触发repaint（重绘），因为没有发现位置变化，不进行渲染</td>
</tr>
<tr>
<td>是否是继承属性</td>
<td>不是继承属性，元素及其子元素都会消失</td>
<td>是继承属性，若子元素使用了visibility:visible，则不继承，这个子孙元素又会显现出</td>
</tr>
</tbody>
</table>
<h5 id="c7">7. CSS中link 和@import的区别</h5>

<blockquote>
<p>link属于XHTML标签，@import完全是CSS提供的一种方式,只能加载CSS</p>
</blockquote>
<blockquote>
<p>加载顺序的差别，当一个页面被加载的时候，link引用的CSS会同时被加载，而@import引用的CSS 会等到页面全部被下载完再被加载</p>
</blockquote>
<blockquote>
<p>兼容性的差别。由于@import是CSS2.1提出的所以老的浏览器不支持，而link标签无此问题</p>
</blockquote>
<blockquote>
<p>当使用javascript控制dom去改变样式的时候，只能使用link标签，因为@import不是dom可以控制的</p>
</blockquote>
<h5 id="c8">8. 什么是响应式设计，响应式设计的基本原理是什么</h5>

<blockquote>
<p>响应式网站设计是一个网站能够兼容多个终端，而不是为每一个终端做一个特定的版本。基本原理是通过媒体查询检测不同的设备屏幕尺寸做处理</p>
</blockquote>
<h5 id="c9">9. 为什么要初始化CSS样式</h5>

<blockquote>
<p>因为浏览器的兼容问题，不同浏览器对有些标签的默认值是不同的，如果没对 CSS 初始化往往会出现浏览器之间的页面显示差异</p>
</blockquote>
<blockquote>
<p>初始化样式会对 SEO 有一定的影响</p>
</blockquote>
<h5 id="c10">10. CSS3有哪些新特性</h5>

<ul>
<li>实现圆角<code>border-radius</code>，阴影<code>box-shadow</code>，边框图片<code>border-image</code></li>
<li>对文字加特效<code>text-shadow</code>，强制文本换行<code>word-wrap</code>，线性渐变<code>linear-gradient</code></li>
<li>实现旋转<code>transform:rotate(90deg)</code>,缩放<code>scale(0.85,0.90)</code>,<code>translate(0px,-30px)</code>定位,倾斜<code>skew(-9deg,0deg)</code>;</li>
<li>增加了更多的CSS选择器、多背景、<code>rgba()</code></li>
<li>唯一引入的伪元素是<code>::selection</code>；</li>
<li>实现媒体查询<code>@media</code>，多栏布局<code>flex</code></li>
<li>过渡<code>transition</code> 动画<code>animation</code></li>
</ul>
<h5 id="c11">11. ::before 和 :after中双冒号和单冒号有什么区别？解释一下这2个伪元素的作用</h5>

<blockquote>
<p>单冒号(:)用于CSS3伪类，双冒号(::)用于CSS3伪元素。（伪元素由双冒号和伪元素名称组成）,双冒号是在当前规范中引入的，用于区分伪类和伪元素</p>
</blockquote>
<h5 id="c12">12. CSS优化、提高性能的方法有哪些</h5>

<ul>
<li>移除空的css规则（Remove empty rules）</li>
<li>正确使用display的属性</li>
<li>不滥用浮动、web字体</li>
<li>不声明过多的font-size</li>
<li>不在选择符中使用ID标识符</li>
<li>遵守盒模型规则</li>
<li>尽量减少页面重排、重绘</li>
<li>抽象提取公共样式，减少代码量</li>
</ul>
<h5 id="c13">13. 重绘和回流</h5>

<p><a href="https://juejin.im/post/5a9923e9518825558251c96a" target="_blank" rel="noopener">重绘和回流</a></p>
<h5 id="c14">14. flex布局</h5>

<p><a href="http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html" target="_blank" rel="noopener">flex布局教程–阮一峰</a></p>
<h5 id="c15">15. css预处理器</h5>

<p>提供了一种css的书写方式，常见的就是 <a href="http://sass.bootcss.com/docs/sass-reference/" target="_blank" rel="noopener">SAAS文档</a> 和 <a href="https://less.bootcss.com/" target="_blank" rel="noopener">LESS文档</a></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="https://wurh.github.io/images/others/weixinshou.png" alt="华Ing WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="https://wurh.github.io/images/others/alifu.png" alt="华Ing Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/前端-知识-面试/" rel="tag">#前端 知识 面试</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/03/31/201904010027/" rel="next" title="前端面试《第十五篇》 Vue.js">
                <i class="fa fa-chevron-left"></i> 前端面试《第十五篇》 Vue.js
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/03/31/201904010040/" rel="prev" title="前端面试《第十七篇》javascript 基础">
                前端面试《第十七篇》javascript 基础 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        
<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2019/03/31/201904010033/"
           data-title="前端面试《第十六篇》 html+css" data-url="http://wurh.github.io/2019/03/31/201904010033/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="//schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://wurh.github.io/images/avatar/logo.jpg?123456"
               alt="华Ing" />
          <p class="site-author-name" itemprop="name">华Ing</p>
          <p class="site-description motion-element" itemprop="description">harder and harder</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">56</span>
              <span class="site-state-item-name">posts</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/wurh" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/1674582564/profile?topnav=1&wvr=6" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.zhihu.com/people/wu-rong-hua-56" target="_blank" title="知乎">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  知乎
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://fsiaonma.github.io/" title="sam博客" target="_blank">sam博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://shenjoel.github.io/" title="joel博客" target="_blank">joel博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://firewood1122.github.io" title="firewood博客" target="_blank">firewood博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://reqianduan.com" title="热前端" target="_blank">热前端</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://opentutorial.info/" title="黄超博客" target="_blank">黄超博客</a>
                </li>
              
            </ul>
          </div>
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#start"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTML"><span class="nav-number">2.</span> <span class="nav-text">HTML</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#l1"><span class="nav-number">2.0.1.</span> <span class="nav-text">1. Doctype作用，HTML5 为什么只需要写 &lt;!DOCTYPE HTML&gt;</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l2"><span class="nav-number">2.0.2.</span> <span class="nav-text">2. 行内元素有哪些，块级元素有哪些，空(void)元素有那些</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l3"><span class="nav-number">2.0.3.</span> <span class="nav-text">3. 简述一下你对HTML语义化的理解</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l4"><span class="nav-number">2.0.4.</span> <span class="nav-text">4. 常见的浏览器内核有哪些，介绍一下你对浏览器内核的理解</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l5"><span class="nav-number">2.0.5.</span> <span class="nav-text">5. html5有哪些新特性</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l6"><span class="nav-number">2.0.6.</span> <span class="nav-text">6. 描述一下 cookie，sessionStorage 和 localStorage 的区别</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l7"><span class="nav-number">2.0.7.</span> <span class="nav-text">7. 如何实现浏览器内多个标签页之间的通信</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l8"><span class="nav-number">2.0.8.</span> <span class="nav-text">8. HTML5的离线存储怎么使用，解释一下工作原理</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l9"><span class="nav-number">2.0.9.</span> <span class="nav-text">9. src与href的区别</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#l10"><span class="nav-number">2.0.10.</span> <span class="nav-text">10. 表单提交中Get和Post方式的区别</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#CSS"><span class="nav-number">3.</span> <span class="nav-text">CSS</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#c1"><span class="nav-number">3.0.1.</span> <span class="nav-text">1. css盒子模型，box-sizing属性的理解</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c2"><span class="nav-number">3.0.2.</span> <span class="nav-text">2. 清除浮动，什么时候需要清除浮动，清除浮动都有哪些方法</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c3"><span class="nav-number">3.0.3.</span> <span class="nav-text">3. 如何让一个不定宽高的盒子水平垂直居中</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c4"><span class="nav-number">3.0.4.</span> <span class="nav-text">4. px和em和rem的区别</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c5"><span class="nav-number">3.0.5.</span> <span class="nav-text">5. position的值有哪些</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c6"><span class="nav-number">3.0.6.</span> <span class="nav-text">6. display:none与visibility：hidden的区别</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c7"><span class="nav-number">3.0.7.</span> <span class="nav-text">7. CSS中link 和@import的区别</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c8"><span class="nav-number">3.0.8.</span> <span class="nav-text">8. 什么是响应式设计，响应式设计的基本原理是什么</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c9"><span class="nav-number">3.0.9.</span> <span class="nav-text">9. 为什么要初始化CSS样式</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c10"><span class="nav-number">3.0.10.</span> <span class="nav-text">10. CSS3有哪些新特性</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c11"><span class="nav-number">3.0.11.</span> <span class="nav-text">11. ::before 和 :after中双冒号和单冒号有什么区别？解释一下这2个伪元素的作用</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c12"><span class="nav-number">3.0.12.</span> <span class="nav-text">12. CSS优化、提高性能的方法有哪些</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c13"><span class="nav-number">3.0.13.</span> <span class="nav-text">13. 重绘和回流</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c14"><span class="nav-number">3.0.14.</span> <span class="nav-text">14. flex布局</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#c15"><span class="nav-number">3.0.15.</span> <span class="nav-text">15. css预处理器</span></a></li></ol></li></ol></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2013 - 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">华Ing</span>
</div>

<div class="powered-by">
  Powered by <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.2"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"wurh"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  






  
  

  

  

  

  


</body>
</html>
